import {fileURLToPath, URL} from 'node:url'

import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'

import {resolve} from 'path'
import {createSvgIconsPlugin} from 'vite-plugin-svg-icons'

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [
        vue(),
        createSvgIconsPlugin({
            iconDirs: [resolve(process.cwd(), "src/icons/svg")], //路径
            symbolId: "icon-[dir]-[name]"
        })
    ],
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        }
    }//--------------------------------- server配置
    , server: {
        host: '0.0.0.0',
        port: 80,
        open: true
    },
    // scss全局变量的一个配置 being
    css: {
        preprocessorOptions: {
            scss: {
                javascriptEnable: true,
                additionalData: `
                    @import "@/styles/variables.scss";
                    @import "@/styles/myvar";
                `
            }
        }
    },
})
